﻿<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<script type="text/javascript">
			$(function(){
				$("#orderSubmit").click(function(){
					window.location="order_confirm?id="+${user.id};
				});
			});
			
		</script>
<h3 id="main-title">购物车</h3>
<c:choose>
	<c:when test="${not empty shoppingCarts }">
		<table id="shoppingCart">
			<tr>
				<th>唱片</th>
				<th>单价</th>
				<th>数量</th>
				<th>小计</th>
				<th>删除</th>
			</tr>
			<c:forEach var="i" items="${shoppingCarts }">
				<tr>
					<td>${i.album.title }</td>
					<td>${i.album.price }</td>
					<td>${i.quantity }</td>
					<td>${i.subtotal}</td>
					<td>
						<form action="deleteShoppingCart" method="post">
							<input type="hidden" name="uid" value="${user.id}" /> <input
								type="hidden" name="id" value="${i.id}" /> <input type="submit"
								value="删除" />
						</form>
					</td>
				</tr>
			</c:forEach>
			<tr>
				<td colspan="3">总计</td>
				<td>总数量:${conut}</td>
				<td>总价格:${price}</td>
			</tr>
		</table>
		<input id="orderSubmit" type="submit" value="订单确认" />
	</c:when>
	<c:otherwise>
		<label id="nullCartTips">您的购物车是空的。</label>
	</c:otherwise>
</c:choose>

